-module( main ).
-export( [ start/0 ] ).

start() ->
  io:format( "Test server started.~n" ),
  %%web:start(),

  Aabb = { {-200.0, -200.0, -200.0}, {200.0, 200.0, 200.0} },
  KinWorld = kinematics:newWorld( Aabb, {50, 50, 50}, 50.0 ),

  GameWorld = gameWorld:start(),

  LoginFun = fun( Login ) ->
    ClientGatePid = self(),
    %%TODO: check login and maybe return { login_refused, Reason }
    ClientObjectPid = clientObject:start( GameWorld, ClientGatePid, KinWorld ),
    ClientId = gameWorld:addUserSync( GameWorld, ClientObjectPid, Login ),
    clientObject:changeClientObjectId( ClientObjectPid, ClientId ),
    { login_ok, ClientObjectPid, ClientId }
  end,

  clientGate:start( LoginFun, 2345 ).
